package auto.f30.yamba;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

public class StatusActivity extends Activity {

	private static final String TAG = "StatusActivity";


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.new_activity_status);
		Log.d(TAG, "Starting Activity");
		
		if (savedInstanceState == null ) {
			StatusFragment fragment = new StatusFragment();
			getFragmentManager().beginTransaction().add(android.R.id.content, fragment, fragment.getClass().getSimpleName()).commit();
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.action_settings:startActivity(new Intent(this,SettingsActivity.class));
		return true;
		case R.id.action_refresh:startService(new Intent(this,RefreshService.class));
		return true;
		default:
			return false;
			
		}

}
}
